const getAccessToken = require('./getAccessToken.js')
const rp = require('request-promise')

const CallCloudStorage = {
    async downLoad(ctx,fileList){
        const ACCESS_TOKEN = await getAccessToken()
        const options = {
            method:'POST',
            uri:`https://api.weixin.qq.com/tcb/batchdownloadfile?access_token=${ACCESS_TOKEN}`,
            body:{
                file_list:fileList,
                env:ctx.state.env
            },
            json:true
        }
        return await rp(options)
            .then(res=>{
                return res
            })
            .catch(err=>{
                console.log(err);
            })
    }
}
module.exports = CallCloudStorage